home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 April (DVD) / PCWELT_4_2006.ISO / Shared.Cst / 00039_Movie Script Main.ls < prev    next >
Encoding:
Text File  |  2004-02-05  |  10.9 KB  |  423 lines

  1. -- Shared scripts for Brief History
  2.  
  3.  
  4.  
  5. -- This starts the voiceOver that is in the variable currentVoice
  6. on PlayVoice
  7.   global voicePath, currentVoice
  8.   sound stop 1
  9.   if currentVoice = "" then
  10.     exit
  11.   end if
  12.   --put voicePath¤tVoice
  13.   sound playFile 1,voicePath¤tVoice
  14.  -- sound fadeIn 1, 1
  15.   --checkDOS currentVoice no longer needed. ΓÇó gkg 9/16/94
  16. end PlayVoice
  17.  
  18.  
  19. -- This determines if the background sound is currently playing, and starts
  20. -- it again if it's not
  21. on PlaySoundTrack
  22.   global soundTrackPath,currentsoundTrack
  23.   if (soundBusy(2)) then exit
  24.   sound playFile 2,soundTrackPath¤tsoundTrack
  25.   --checkDOS currentsoundTrack  --no longer needed. ΓÇó gkg 9/16/94
  26.   -- Updatestage -- REMOVED by TRS 9/11/94 (No reason for it)
  27. end PlaySoundTrack
  28.  
  29.  
  30. -- When the spacebar is hit, the volume controls pop on and off the screen
  31. on ToggleVolumeWindow
  32.   global vWindow,vSlider1,vSlider2,volumeHPositions
  33.   if the left of sprite vWindow > 641 then
  34.     set the locH of sprite vWindow to value(item 1 of volumeHPositions)
  35.     set the locH of sprite vSlider1 to value(item 2 of volumeHPositions)
  36.     set the locH of sprite vSlider2 to value(item 3 of volumeHPositions)
  37.     updateStage
  38.   else
  39.     set the locH of sprite vWindow to 12000
  40.     set the locH of sprite vSlider1 to 12000
  41.     set the locH of sprite vSlider2 to 12000
  42.     updateStage
  43.   end if
  44. end ToggleVolumeWindow
  45.  
  46.  
  47. -- Drag a slider when the mouse is clicked and held down on it
  48. on DragSlider whichOne
  49.   global sliderTop,sliderBottom
  50.   put (the locV of sprite whichOne) - the mouseV into vOffset
  51.   repeat while the stillDown
  52.     if (the mouseV >= sliderTop) AND (the mouseV <= sliderBottom) then
  53.       set the locV of sprite whichOne = (the mouseV + vOffset)
  54.       updateStage
  55.     end if
  56.   end repeat
  57.   SetSliderLevel(whichOne)
  58. end DragSlider
  59.  
  60.  
  61. -- This figures out where the slider should be on the scale based on the level of the sound channel
  62. on SetSliderVolume whichChannel
  63.   global sliderTop,sliderBottom,vSlider1,vSlider2,ambientLevel,voiceLevel
  64.   if whichChannel = vSlider1 then
  65.     put 1 into channelNum
  66.   else
  67.     put 2 into channelNum
  68.   end if
  69.   put 255 into volumeTop
  70.   put sliderBottom - sliderTop into range
  71.   put the volume of sound channelNum into howLoud
  72.   set the locV of sprite whichChannel = sliderBottom - integer((range * howLoud) / volumeTop)
  73.   updateStage
  74. end SetSliderVolume
  75.  
  76.  
  77. -- This determines what the volume should be based on the level of the slider
  78. on SetSliderLevel whichSlider
  79.   global sliderTop,sliderBottom,vSlider1,vSlider2,ambientLevel,voiceLevel
  80.   put sliderBottom - sliderTop into range
  81.   put (sliderBottom - (the locV of sprite whichSlider)) into where
  82.   put float(where) / range into where
  83.   put integer(where * 255) into sliderV
  84.   if whichSlider = vSlider1 then
  85.     set the volume of sound 1 to sliderV
  86.     put sliderV into voiceLevel
  87.   else
  88.     set the volume of sound 2 to sliderV
  89.     put sliderV into ambientLevel
  90.   end if
  91.   updateStage
  92. end SetSliderLevel
  93.  
  94.  
  95. -- This makes the sound controls visible and invisible if the spacebar is pressed
  96. on keyCheck
  97.   if the key = " " then ToggleVolumeWindow
  98. end keyCheck
  99.  
  100.  
  101. on soundSetup
  102.   -- globals used
  103.   global voicePath,soundTrackPath,currentVoice,currentsoundTrack
  104.   global vWindow,vSlider1,vSlider2,sliderTop,sliderBottom,volumeHPositions
  105.   global ambientLevel, voiceLevel
  106.   
  107.   -- voicePath:               Variable holding the path to the voice sound folder
  108.   -- currentVoice:          Variable holding the name of the currently playing voiceover file
  109.   -- soundTrackPath:      Variable holding the path to the sound folder
  110.   -- currentsoundTrack: Variable holding the name of the currently playing ambient file
  111.   -- ambientLevel:          Current volume for sound channel 1
  112.   -- voiceLevel:             Current volume for sound channel 2
  113.   -- vWindow:                Volume window sprite channel
  114.   -- vSlider1:                Channel number for slider for volume of voice
  115.   -- vSlider2:                Channel number for slider for volume of ambient sound
  116.   -- sliderTop:               The vertical coordinate of the top of the volume controls
  117.   -- sliderBottom:          The vertical coordinate of the bottom of the volume controls
  118.   -- volumeHPositions:   The horizontal coordinates of the 3 volume elements
  119.   
  120.   -- The following 3 variables can be whatever you'd like
  121.   -- This initializes the global variable that references the channel
  122.   -- for the volume slider background
  123.   put 46 into vWindow
  124.   -- This initializes the slider for controlling the level of sound 1
  125.   put 47 into vSlider1
  126.   -- This initializes the slider for controlling the level of sound 2
  127.   put 48 into vSlider2
  128.   -- The next 2 lines determine the top and bottom for the range on the slider controls
  129.   put (the top of sprite vWindow) + 26 into sliderTop
  130.   put (the bottom of sprite vWindow) - 32 into sliderBottom
  131.   -- These are the horizontal coordinates of all the volume controls when on the stage
  132.   -- The first is the slider background, then the left slider, and the right
  133.   -- You can alter the vertical coordinates, and change these to suite your artwork
  134.   put "320,302,338" into volumeHPositions
  135.   
  136.   -- This loads the variable holding the current sound level for each channel
  137.   set the volume of sound 2 to ambientLevel
  138.   set the volume of sound 1 to voiceLevel
  139.   -- This actually sets the level of the slider on the controller
  140.   SetSliderVolume(vSlider1)
  141.   SetSliderVolume(vSlider2)
  142.   -- Start the background sound playing
  143.   --PlaySoundTrack
  144.   
  145.   -- test
  146.   -- take this out for now
  147.   --PlayVoice
  148.   -- Check to see if any keys are pressed, especially the space bar
  149.   when keyDown then keyCheck
  150.   
  151.   -- Place into score where multiple voice overs are used on successive frames
  152.   -- put "voiceIntro" into currentVoice
  153.   -- PlayVoice
  154. end soundSetup
  155.  
  156. on ClearPuppets
  157.   repeat with i = 1 to 44
  158.     puppetSprite i, False
  159.   end repeat
  160. end
  161.  
  162. on stopmovie
  163.   global gFlyThru, gCraftBefore
  164.   repeat with i = 1 to 40
  165.     puppetSprite i, False
  166.   end repeat
  167.   set gFlyThru = 2
  168.   set gCraftBefore = False
  169.   set the timeoutScript to "nothing"
  170.   clearPuppets
  171.   sound stop 1
  172.   sound FadeOut 2, 1*60
  173.   sound FadeIn 2, 1*60
  174. end
  175.  
  176.  
  177. on NextScreen
  178.   clearPuppets
  179.   sound stop 1
  180.   unload
  181.   set lFrame1 = marker(1)
  182.   set lFrame2 = (marker(2) - 1)
  183.   preload lFrame1, lFrame2
  184. end
  185.  
  186. on EndOfSceneFrame lFrame
  187.   global gWaitForUser
  188.   if gWaitForUser = False then
  189.     go to the frame
  190.   else
  191.     if soundBusy(1) = True then
  192.       go to the frame
  193.     else
  194.       NextScreen
  195.       go to frame lFrame
  196.     end if
  197.   end if
  198. end
  199.  
  200. on EndOfScene
  201.   global gWaitForUser
  202.   if gWaitForUser = False then
  203.     go to the frame
  204.   else
  205.     if soundBusy(1) = True then
  206.       go to the frame
  207.     else
  208.       NextScreen
  209.       go to marker(1)
  210.     end if
  211.   end if
  212. end
  213.  
  214. on EndOfSceneWithLoop
  215.   global gWaitForUser
  216.   if (the frame + 1) = marker(1) then
  217.     if gWaitForUser = False then
  218.       go to frame (marker(0) + 1)
  219.     else
  220.       if soundBusy(1) = True then
  221.         go to frame (marker(0) + 1)
  222.       else
  223.         NextScreen
  224.         go to marker(1)
  225.       end if
  226.     end if
  227.   else
  228.     if gWaitForUser = False then
  229.       go to (the frame + 1)
  230.     else
  231.       if soundBusy(1) = True then
  232.         go to (the frame + 1)
  233.       else
  234.         NextScreen
  235.         go to marker(1)
  236.       end if
  237.     end if
  238.   end if
  239. end
  240.  
  241. on EndOfSceneWithLoopMovie lMovie
  242.   global gWaitForUser
  243.   if (the frame + 1) = marker(1) then
  244.     if gWaitForUser = False then
  245.       go to frame (marker(0) + 1)
  246.     else
  247.       if soundBusy(1) = True then
  248.         go to frame (marker(0) + 1)
  249.       else
  250.         ClearPuppets
  251.         puppetSprite 45, False
  252.         go movie lmovie
  253.       end if
  254.     end if
  255.   else
  256.     if gWaitForUser = False then
  257.       go to (the frame + 1)
  258.     else
  259.       if soundBusy(1) = True then
  260.         go to (the frame + 1)
  261.       else
  262.         ClearPuppets
  263.         puppetSprite 45, False
  264.         go movie lMovie
  265.       end if
  266.     end if
  267.   end if
  268. end
  269.  
  270. on EndOfSceneFinal
  271.   global gWaitForUser
  272.   if gWaitForUser = False then
  273.     go to the frame
  274.   else
  275.     if soundBusy(1) = True then
  276.       go to the frame
  277.     else
  278.       NextScreen
  279.       go to frame "enter" of movie "Main"
  280.     end if
  281.   end if
  282. end
  283.  
  284. on EndOfSceneFinalWithLoop
  285.   global gWaitForUser
  286.   if (the frame + 1) = marker(1) then
  287.     if gWaitForUser = False then
  288.       go to frame (marker(0) + 1)
  289.     else
  290.       if soundBusy(1) = True then
  291.         go to frame (marker(0) + 1)
  292.       else
  293.         ClearPuppets
  294.         puppetSprite 45, False
  295.         go to frame "Enter" of movie "Main"
  296.       end if
  297.     end if
  298.   else
  299.     if gWaitForUser = False then
  300.       go to (the frame + 1)
  301.     else
  302.       if soundBusy(1) = True then
  303.         go to (the frame + 1)
  304.       else
  305.         ClearPuppets
  306.         puppetSprite 45, False
  307.         go to frame "Enter" of movie "Main"
  308.       end if
  309.     end if
  310.   end if
  311. end
  312.  
  313.  
  314. on EndOfSceneMovie lmovie
  315.   global gWaitForUser
  316.   if gWaitForUser = False then
  317.     go to the frame
  318.   else
  319.     if soundBusy(1) = True then
  320.       go to the frame
  321.     else
  322.       ClearPuppets
  323.       puppetSprite 45, False
  324.       go to movie lmovie
  325.     end if
  326.   end if
  327. end
  328.  
  329.  
  330. on NextScreenFrame lFrame
  331.   clearPuppets
  332.   sound stop 1
  333.   unload
  334.   set lFrame1 = lFrame
  335.   go to lFrame
  336.   set lFrame2 = (marker(1) - 1)
  337.   preload lFrame1, lFrame2
  338. end
  339.  
  340.  
  341.  
  342. on EndOfSceneWithQT lSpriteNumber
  343.   global gWaitForUser
  344.   if the movieTime of sprite lSpriteNumber ┬¼
  345. < the stopTime of sprite lSpriteNumber then
  346.     go to the frame
  347.     exit
  348.   else
  349.     if gWaitForUser = False then
  350.       go to the frame
  351.     else
  352.       NextScreen
  353.       set the movieTime of sprite lSpriteNumber = 0
  354.       set the movieRate of sprite lSpriteNumber = 0
  355.       go to marker(1)
  356.     end if
  357.   end if
  358. end
  359.  
  360. on ResetQT lSpriteNumber
  361.   set the movieTime of sprite lSpriteNumber = 0
  362.   set the movieRate of sprite lSpriteNumber = 0
  363. end
  364.  
  365.  
  366. on EndOfSceneMovieWithQT lSpriteNumber, lmovie
  367.   global gWaitForUser
  368.   if the movieTime of sprite lSpriteNumber ┬¼
  369. < the stopTime of sprite lSpriteNumber then
  370.     go to the frame
  371.     exit
  372.   else
  373.     if gWaitForUser = False then
  374.       go to the frame
  375.     else
  376.       NextScreen
  377.       set the movieTime of sprite lSpriteNumber = 0
  378.       set the movieRate of sprite lSpriteNumber = 0
  379.       ClearPuppets
  380.       puppetSprite 45, False
  381.       go movie lmovie
  382.     end if
  383.   end if
  384. end
  385.  
  386.  
  387. on waitNew lamount
  388.   starttimer
  389.   repeat while the timer < (lamount * 60)
  390.     nothing
  391.   end repeat
  392. end
  393.  
  394.  
  395. -- Error checking code to determine DOS file name compatibility. ΓÇó DKA 9/11/94 
  396. on checkDOS SoundFileName
  397.   set x = offset (".", SoundFileName)
  398.   put "Sound name:" && SoundFileName && "    Name length ="&&string(x-1)
  399.   if x > 9 then alert "Name too long"
  400. end
  401.  
  402. --looks for above 8 bit bitmaps. ΓÇó gkg 9/14/94
  403. on checkColor
  404.   repeat with x = 1 to 1200
  405.     if the castType of cast x = #bitmap then
  406.       if the depth of cast x > 8 then
  407.         alert "Crummy Cast" && "at cast" && string(x)
  408.       end if
  409.     end if
  410.   end repeat
  411. end
  412.  
  413. --checks inks of sprites on currentframeΓÇó gkg 9/16/94
  414.  
  415. on checkInks
  416.   repeat with x = 1 to 30
  417.     set i = the ink of sprite x
  418.     if i <> 0 then
  419.       put "sprite" && x && "uses ink effect:" && i
  420.     end if
  421.   end repeat
  422. end
  423.